package com.zhuhjay.oss.controller;

import com.zhuhjay.commonutils.R;
import com.zhuhjay.oss.service.OssService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author ZhuHJay
 * @date 2022/9/6 15:21
 */
@RestController
@RequestMapping("/eduoss/fileoss")

public class OssController {

    @Resource
    private OssService ossService;

    @PostMapping
    public R uploadOssFile(MultipartFile file) {
        // 上传文件，并获取到文件路径
        return R.ok().data("url", ossService.uploadFileAvatar(file));
    }

}
